﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace T10Field
{
    class Program
    {
        static void Main(string[] args)
        {
            Account a1 = new Account();
            Console.WriteLine("{0}{1}",a1.type,Account.total);
            a1.username = "张三";//修改实例字段
            Account a2 = new Account();
            Console.WriteLine("{0}{1}", a2.type, Account.total);
            //a2.type = "不能修改只读字段";
            a2.username = "李四";//修改实例字段
            Console.ReadKey();
        }
    }
    class Account
    {
        public static int total;//静态对象-->属于类的所有对象
        public string username;//实例对象-->属于类的单个对象
        public const double PI = 3.1415;//常量字段
        public readonly string type;//只读字段-->可以在定义或构造函数中初始化
        public Account()
        {
            total++;
            type = "账户类型";
        }


            



    }

}
